﻿<MudButton @onclick="@(() => _dialogOpen = !_dialogOpen)" Variant="Variant.Filled" Color="Color.Primary">
    Open simple dialog
</MudButton>

<MudDialog @bind-Visible="_dialogOpen" Style="width: 80%; height: 80%;">
    <DialogContent>
        <MudButton Variant="Variant.Text" OnClick="@(() => OpenDrawer(Anchor.End))">Open Drawer</MudButton>
        <MudDrawer @bind-Open="@_open" Anchor="@_anchor" Elevation="1" Variant="@DrawerVariant.Temporary" OverlayAutoClose="@OverlayAutoClose">
            <MudDrawerHeader>
                <MudText Typo="Typo.h6">My App</MudText>
            </MudDrawerHeader>
            <MudSelect T="int" Label="Label">
                <MudSelectItem T="int" Value="1">1</MudSelectItem>
                <MudSelectItem T="int" Value="2">2</MudSelectItem>
                <MudSelectItem T="int" Value="3">3</MudSelectItem>
                <MudSelectItem T="int" Value="4">4</MudSelectItem>
                <MudSelectItem T="int" Value="5">5</MudSelectItem>
            </MudSelect>
        </MudDrawer>
    </DialogContent>
</MudDialog>

@code {
    public static string __description__ = "Drawer inside a Dialog with a Select inside the Drawer make sure z-index is not overridden by css.";
    private bool _dialogOpen;
    private bool _open;
    private Anchor _anchor;
    private const bool OverlayAutoClose = true;

    private void OpenDrawer(Anchor anchor)
    {
        _open = true;
        _anchor = anchor;
    }
}
